﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="update.aspx.cs" ValidateRequest="false" MasterPageFile="~/admin/MasterPage.master" Inherits="admin_law_update" %>
<%@ Import Namespace="System.Data" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="admin-position">当前位置 -> 产品展示</h1>
<table cellpadding="0" cellspacing="0" class="admin-tab-table">
    <tr>
        <th>
            <ul style="margin-left:30px;">
                <li class="btn_selected"><a href="list.aspx" >全部产品</a></li><li class="btn"><a href="update.aspx" class="selected">编辑产品</a></li>
            </ul>
        </th>
        <th style="text-align:right;">
        </th>
    </tr>
</table>

<script type="text/javascript" src="../../plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/assets/javascript/jquery-1.5.1.min.js"></script>
<link rel="stylesheet" href="/plugins/kindeditor/themes/default/default.css" />
<link type="text/css" rel="stylesheet" href="/plugins/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" type="text/javascript" src="/plugins/kindeditor/kindeditor.js"></script>
<script charset="utf-8" type="text/javascript" src="/plugins/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" type="text/javascript" src="/plugins/kindeditor/plugins/code/prettify.js"></script>
<script type="text/javascript">
    KindEditor.ready(function (K) {
        var editor1 = K.create('#ta_ckeditor', {
            height: '400px',
            width: '700px',
            cssPath: '/plugins/kindeditor/plugins/code/prettify.css',
            uploadJson: '/plugins/kindeditor/asp.net/upload_json.ashx',
            fileManagerJson: '/plugins/kindeditor/asp.net/file_manager_json.ashx',
            allowFileManager: true,
            afterCreate: function () {
                var self = this;
                K.ctrl(document, 13, function () {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function () {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        prettyPrint();
    });
    $(document).ready(function () {
        $("#type").change(function () {
            var posturl = '/admin/product/ajaxcategory.aspx?upid=' + $(this).val();
            $.ajax({
                url: posturl,
                success: function (data) {
                    var obj = JSON.parse(data);
                    $('#catid').children().remove();
                    for (i = 0; i < obj.length; i++) {
                        $('#catid').append("<option value=" + obj[i].id + ">" + obj[i].name + "</option>")
                    }
                },

            });
        });
    });
    function datepick() {
        WdatePicker({ skin: 'blueFresh', dateFmt: 'yyyy-MM-dd' });
    }
</script>
<form id="Form1" name="form1" method="post" action="doupdate.aspx" runat="server">
<table cellpadding="0" cellspacing="0" class="admin-post-table">
    <tr>
        <th>产品名称</th><td><input name="subject" type="text" style="width:300px;" value="<%=detail.Rows[0]["name"].ToString().Trim() %>" /></td>
    </tr>
        <tr>
        <th>产品型号</th><td><input name="model" type="text" style="width:200px;" value="<%=detail.Rows[0]["model"].ToString().Trim() %>" /></td>
    </tr>
    <tr>
        <th>日期</th><td><input name="eventdate" type="text" onclick='datepick();' value="<%=detail.Rows[0]["eventdate"] %>" /></td>
    </tr>
    <tr>
        <th>缩略图</th><td><asp:FileUpload ID="file" runat="server" /></td>
    </tr>
    <tr>        
        <th>产品描述</th><td><textarea id="ta_ckeditor" class="ckeditor" name="content" cols="20" rows="2" style="overflow:auto"><%=detail.Rows[0]["pdesc"].ToString().Trim() %></textarea></td>
    </tr>
    <tr>        
        <th>商品大类</th>
        <td>
            <select name="type" id="type">

                <%foreach (TreeNode tn in treeView.Nodes)
                  { %>
                <option value="<%=tn.Value.ToString() %>" <% if (tn.Value.ToString() == detail.Rows[0]["type"].ToString())
                                                             { %>selected='selected'<%} %>><%=tn.Text.ToString() %></option>
                <% } %>
            </select>
        </td>
    </tr>
    <tr>        
        <th>二级分类</th>
        <td>
            <select name="catid" id="catid">
                <% if( subcategory != null ){ %>
                <% foreach( DataRow dr in subcategory.Rows ){ %>
                    <option value="<%=dr["id"].ToString().Trim() %>" <% if(dr["id"].ToString() == detail.Rows[0]["catid"].ToString()){ %>selected='selected'<%} %>><%=dr["name"].ToString() %></option>
                <% } %>
                <% } %>
            </select>
        </td>
    </tr>
    <tr>
        <th style="height:30px;">置顶</th><td><input type="radio" name="settop" value="0" <%if(detail.Rows[0]["tops"].ToString().Trim()=="0"){ %> checked="checked"<%} %> /> 不置顶 <input type="radio" name="settop" <%if (detail.Rows[0]["tops"].ToString().Trim() == "1")
                                                                                                                                                                                                                     { %> checked="checked"<%} %> value="1"/> 置顶</td>
    </tr>
</table>


<input type="submit" value="提交" /><input type="hidden" name="id" value="<%=detail.Rows[0]["id"].ToString().Trim() %>" />
</form>
</asp:Content>